<template>
  <view class="pageLayout">
    <view
      class="cus_car"
      v-for="item in dataList"
      :key="item.customerID"
      @click="clickItem(item)"
    >
      <view class="top">
        <text class="detail">查看详情</text>
        <u-icon name="arrow-right" color="#1C1B2680" size="10"></u-icon>
      </view>
      <view class="cus_box">
        {{ item.customerName }}-{{
          item.customerPhoneNumber ? item.customerPhoneNumber + "/" : ""
        }}{{ item.appNumber ? item.appNumber : "" }}
      </view>
      <view class="tips_box">
        <view
          class="tips s"
          v-if="item.customerServiceCustomerSourceLevel === 'S'"
          >S级</view
        >
        <view
          class="tips a"
          v-else-if="item.customerServiceCustomerSourceLevel === 'A'"
          >A级</view
        >
        <view
          class="tips b"
          v-else-if="item.customerServiceCustomerSourceLevel === 'B'"
          >B级</view
        >
        <view
          class="tips c"
          v-else-if="item.customerServiceCustomerSourceLevel === 'C'"
          >C级</view
        >
        <view
          class="tips d"
          v-else-if="item.customerServiceCustomerSourceLevel === 'D'"
          >D级</view
        >
      </view>
      <view class="time">
        <u-icon name="clock-fill" size="12" color="#8d8d92"></u-icon>
        <view class="time_detail">{{
          formatTimestamp(item.allocationTime, "onlyDate")
        }}</view>
      </view>
      <view class="server_box">
        <u-icon name="account-fill" size="12" color="#8d8d92"></u-icon>
        <view class="server_name">客服：{{ item.customerServiceName }}</view>
        <view v-if="item.customerServiceGroupLeaderName">|</view>
        <view v-if="item.customerServiceGroupLeaderName" class="server_gropup"
          >组长：{{ item.customerServiceGroupLeaderName }}</view
        >
      </view>
    </view>
    <view v-if="dataList.length == 0">
      <u-empty mode="list" >
      </u-empty>
    </view>
  </view>
</template>

<script>
import store from "../../store/index";
import { queryCustomerByClassApi } from "@/api/customer/index";
export default {
  components: {},
  data() {
    return {
      id: "",
      dataList: [],
    };
  },
  computed: {
    hasLogin() {
      return this.$store.state.token && this.$store.state.token.length > 0;
    },
  },
  onLoad(options) {
    console.log(options, "options");
    this.id = options.id;
    this.getList();
  },
  methods: {
    /**
     * 点击列表跳转详情页
     */
    clickItem(item) {
      // console.log(item,'item');
      uni.navigateTo({
        url: `/pages/customer/detail?id=${item.customerResourceID}`,
      });
    },
    /**
     * 获取列表
     */
    getList() {
      let data = {
        classeseRecordID: this.id,
      };
      queryCustomerByClassApi(data).then((res) => {
        // console.log(res,'res');
        // return
        this.dataList = res.data;
        // console.log(this.dataList,'this.dataList');
      });
    },
  },
  onShow() {},
  /**
   * 上拉加载更多
   */
  onReachBottom() {},
};
</script>
<style>
page {
  background-color: #f5f7fb;
}
</style>
<style lang="scss" scoped>
.pageLayout {
  padding: 40rpx;
}
.cus_car {
  background-color: #ffffff;
  width: 670rpx;
  height: 207rpx;
  padding: 40rpx;
  box-sizing: border-box;
  padding-top: 13rpx;
  margin-bottom: 24rpx;
  .top {
    display: flex;
    color: #1c1b2680;
    font-size: 20rpx;
    justify-content: flex-end;
  }
  .cus_box {
    font-weight: 700;
    color: #000000;
    font-size: 24rpx;
  }
  .tips_box {
    display: flex;
    .tips {
      padding: 2rpx 18rpx;
      font-size: 16rpx;
      margin-right: 5rpx;
      margin-top: 8rpx;
    }
    .s {
      color: #a22c26;
      border: 1rpx solid #a22c26;
      background-color: #fbe6e8;
    }
    .a {
      color: #fe8b00;
      border: 1rpx solid #fe8b00;
      background-color: #fff9eb;
    }
    .b {
      color: #52c41a;
      border: 1rpx solid #52c41a;
      background-color: #f6ffed;
    }
    .c {
      color: #1677ff;
      border: 1rpx solid #1677ff;
      background-color: #e6f4ff;
    }
    .d {
      color: #b088fa;
      border: 1rpx solid #b088fa;
      background-color: #f0e8ff;
    }
  }
  .time {
    display: flex;
    align-items: baseline;
    font-size: 22rpx;
    margin-top: 12rpx;
    .time_detail {
      margin-left: 10rpx;
    }
  }
  .server_box {
    display: flex;
    align-items: baseline;
    font-size: 22rpx;
    margin-top: 12rpx;
    .u-icon {
      margin-right: 10rpx;
    }
    .server_name {
      margin-left: 10rpx;
      margin-right: 10rpx;
    }
    .server_gropup {
      margin-left: 10rpx;
    }
  }
}
</style>